package com.ym.manager.admin.goods;

import com.ym.base.BaseDao;
import com.ym.manager.admin.goods.model.Goods;
import com.ym.manager.admin.goods.model.GoodsAttribute;
import com.ym.manager.admin.goods.model.GoodsStatusTotal;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface GoodsDao extends BaseDao {

    //项目总数
    int getListCount(Map<String,Object> map);
    //项目列表
    List<Goods> getList(Map<String,Object> map);

    int deleteByPrimaryKey(Integer id);

    int insert(Goods record);

    int insertSelective(Goods record);

    int update(Goods record);

    int updateByPrimaryKey(Goods record);

    //获取各个状态的产品总数
    List<Map<String,Object>> goodsStatusTotal(int hospital_id);
    //获取产品详情
    Goods detail(int id);
    //上下架产品
    int shelf(@Param("id") int id,@Param("shelf") int shelf);
    //根据机构id获取项目，不分页
    List<Goods> goodsList(int hospital_id);
    //获取订单中的产品详情
    Goods orderGoodsDetail(String order_sn);
    //获取类目下的产品列表
    List<Goods> getCategoryGoodsList(@Param("hospital_id") int hospital_id,@Param("categoryPid") int categoryPid,@Param("categoryId") int categoryId);
    //新增项目信息
    void insertAttribute(Integer id);
    //获取用户的分佣比例值
    Integer getUserRate();
    //商品入库
    int addInventory(@Param("goods_id") int goods_id,
                     @Param("validity") String validity,
                     @Param("inventory") int inventory);
    //增加商品库存信息
    void addGoodsInventory(@Param("goods_id") int goods_id,
                           @Param("inventory") int inventory);
    //获取商品库存
    int getInventory(@Param("goods_id") int goods_id,
                     @Param("time") String time);
    //根据商品id获取入库有效期集
    List<String> getSeckillTime(@Param("goods_id") int goods_id,
                                @Param("time") String time);
    //获取最大排序值
    long getMaxIdx();
}